/**
 * Created by wangyg6 on 2017/11/23.
 */
public class QuestionValidator {
	//考虑到每个订单都有6~7次rpc请求，设计个大小为1的缓存，类似于粘贴版。
	final static String[] cache = new String[2];

	public static void main(String[] args) {
		String result = qryStaffOperatorsRelaOfChain("areaId", "staffId");
		System.out.println(result);
		String result2 = qryStaffOperatorsRelaOfChain("areaId", "staffId");
		System.out.println(result2);
		String result3 = qryStaffOperatorsRelaOfChain("areaId1", "staffId1");
		System.out.println(result3);
	}

	public static String qryStaffOperatorsRelaOfChain(String areaId, String staffId) {
		// 调用系管接口，根据渠道id查询经营主体
		String key = "key_" + areaId + "_" + staffId;
		String outJsonString = null;
		if (cache[0] != null && key.equals(cache[0])) {
			return cache[1];
		}
		outJsonString = "1234567890";
		// 转换接口调用回参
		cache[0] = key;
		cache[1] = null;
		if (outJsonString != null) {
			cache[1] = outJsonString;
			return outJsonString;
		} else {
			return null;
		}
	}
}